const o = {
	":": " ",
	"{": "\r\n",
	"}": "\r\n",
	"[": "\r\n",
	"]": "\r\n",
	",": "\r\n",
}

module.exports = function formatJSON(jsonStr) {
	console.log(jsonStr);
	const result = [];
	const indent = 2;
	const indentGrad = 0;
	const quotStack = [];
	let preChar = '';
	for (const char of jsonStr) {
		if (preChar === '\r\n') {
			//处理缩进
			result.push(...Array(indent * indentGrad).fill(" "));	
		}
		//推入字符
		result.push(char);
		if (char === "{" || char === "[") {
			quotStack.push(char);
		}
		
		preChar = char;
		//获取需要推入的下一个字符
		const nextChar = o[char];
		if (nextChar) {
			
		}
	}
}


module.exports(JSON.stringify({
	name: "name",
	age: "age",
	djs:["1","2"]
}, null, 2));